package collection

/**
 * 扩展函数,交换集合元素
 */
fun MutableList<Int>.exchange(formIndex: Int, toIndex: Int) {
    val temp = this[formIndex]
    this[formIndex] = this[toIndex]
    this[toIndex] = temp
}

/**
 * 扩展属性,判断集合数据个数是否是偶数个
 */
val MutableList<Int>.sumIsEven: Boolean get() = this.sum() % 2 == 0
